<template>
	<div>
		<el-dialog
			:title="props.title"
			v-model="props.open"
			width="400px"
			align-center
			:show-close="false"
			:close-on-press-escape="false"
			:close-on-click-modal="false"
			append-to-body
		>
			<el-upload
				v-model:file-list="fileList"
				ref="uploadRef"
				:limit="1"
				accept=".xlsx, .xls"
				action=""
				:disabled="false"
				:auto-upload="false"
				drag
			>
				<el-icon class="el-icon--upload"><upload-filled /></el-icon>
				<div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
				<template #tip>
					<div class="el-upload__tip text-center" style="margin-top: 30px">
						<span>仅允许导入xls、xlsx格式文件。</span>
<!--						<el-link
							type="primary"
							:underline="false"
							style="font-size: 12px; vertical-align: baseline"
							@click="importTemplate"
							>下载模板</el-link
						>-->
					</div>
				</template>
			</el-upload>
			<template #footer>
				<div class="dialog-footer">
					<el-button type="primary" @click="submitFileForm()">确 定</el-button>
					<el-button @click="CloseUpload()">取 消</el-button>
				</div>
			</template>
		</el-dialog>
	</div>
</template>
<script  setup>
import { ref } from "vue";
import { UploadFilled } from "@element-plus/icons-vue";
/*import { useSystem } from "@/config"; //接口方法
const { service } = useSystem(); //接口方法
import { useDownload } from "$/upload/hooks/useDownload"; // 下载*/
const emits = defineEmits(["CloseUpload", "submitFileForm"]);
/**
 * @description: 接收数据
 * @param fileName  下载模板名
 * @param title 弹窗名称
 * @param open 弹窗开启状态
 * @return {*}
 */
const props = defineProps({
	fileName: {
		type: String
	},
	title: {
		type: String
	},

});
const open=ref(false)
/**
 * @description: 下载模板
 * @return {*}
 */
/*const importTemplate = async () => {
	const fileName = props.fileName as string;
	const response = await service.addAssetsApply.downloadEquipment(fileName);
	useDownload(response, fileName, ``);
};*/

/**
 * @description: 导入确认
 * @return {fileList}上传的文件
 */
const fileList = ref([]);
const submitFileForm = () => {
	emits("submitFileForm", fileList);
};

/**
 * @description: 关闭弹窗
 * @return {data} false
 */
const CloseUpload = () => {
	emits("CloseUpload", false);
};
const openUpload = () => {
  open.value=true
};
defineExpose({
  openUpload
});
</script>

<style scoped></style>
